public class AptiIntegration {
   
    public class AptiServicesRest {
    	public string send(string requestId,string aptiId, string statusDetail)
	    {
	    	HttpRequest req = new HttpRequest();
	        HttpResponse res = new HttpResponse();
	        Http http = new Http();
	        
	        req.setEndpoint('https://netbatch.aptimus.com/profile-services/ws-rest/lead/v1/status/update');
	        req.setMethod('POST');
	        req.setHeader('Content-Type','text/xml; charset=utf-8');
	        system.debug('I came here');
	        string request_apti = '<?xml version="1.0" encoding="UTF-8"?>'+
	                '<AptiTransmission>'+
	                '   <DeliveryDetails>'+
	                '       <RequestId>'+ requestId+'</RequestId>'+
	                '       <RequestTime>'+ system.now() +'</RequestTime>'+    
	                '   </DeliveryDetails>'+    
	                '   <Lead>'+      
	                '       <LeadId>'+aptiId+'</LeadId>'+
	                '       <StatusType>'+statusDetail+'</StatusType>'+
	                '       <StatusNote>Reject</StatusNote>'+ 
	                '       <StatusDate>'+ system.now() +'</StatusDate>'+    
	                '   </Lead>'+  
	                '</AptiTransmission>';
	        req.setBody(request_apti);
	        /*try {
	            res = http.send(req);
	            system.debug(res.getBody());
	        } catch(System.CalloutException e) {
	            System.debug('Callout error: '+ e);
	            //System.debug(res.toString());
	            
	        } */ 
	        res = http.send(req);
	        return res.getBody();  
	    }
    }
    
    
    /*
    @future(callout=true)
    public static void send()
    {
    	HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
        
        req.setEndpoint('https://netbatch.aptimus.com/profile-services/ws-rest/lead/v1/status/update');
        req.setMethod('POST');
        req.setHeader('Content-Type','text/xml; charset=utf-8');
        system.debug('I came here');
        string request_apti = '<?xml version="1.0" encoding="UTF-8"?>'+
                '<AptiTransmission>'+
                '   <DeliveryDetails>'+
                '       <RequestId>10378659</RequestId>'+
                '       <RequestTime>2011-12-01T18:32:41</RequestTime>'+    
                '   </DeliveryDetails>'+    
                '   <Lead>'+      
                '       <LeadId>1582059</LeadId>'+
               // '       <StatusType>Reject</StatusType>'+
                '       <StatusNote>Reject</StatusNote>'+ 
                '       <StatusDate>2011-12-01T17:19:00</StatusDate>'+    
                '   </Lead>'+  
                '</AptiTransmission>';
        req.setBody(request_apti);
        try {
            res = http.send(req);
            system.debug(res.getBody());
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(res.toString());
        }    
    }
     */
     
}